# Contributor: Andy Postnikov <apostnikov@gmail.com>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>

pkgname=php82-pecl-igbinary
_extname=igbinary
pkgver=3.2.7
pkgrel=0
pkgdesc="Igbinary is a drop in replacement for the standard PHP 8.2 serializer - PECL"
url="https://pecl.php.net/package/igbinary"
arch="all"
license="BSD-3-Clause"
depends="php82-common"
makedepends="php82-dev php82-pecl-apcu"
checkdepends="php82-session" # sessions needs work https://github.com/igbinary/igbinary/issues/116
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"

build() {
	# upstream issue https://github.com/igbinary/igbinary/issues/359
	rm -f tests/igbinary_065.phpt tests/igbinary_073.phpt
	phpize82
	./configure --prefix=/usr --with-php-config=php-config82
	make
}

check() {
	local _modules="/usr/lib/php82/modules"
	# Tests require extra extensions which are not bundled
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test \
		TESTS=--show-diff \
		PHP_TEST_SHARED_EXTENSIONS=" \
		-d extension=$_modules/apcu.so \
		-d extension=$_modules/session.so \
		-d extension=modules/$_extname.so"
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/php82/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/10_$_extname.ini
}

sha512sums="
b168e9b7aecaa9ae7760d813f2225381333b8f9a0611cc9701307202da5fefc8239dff5a4ed65faf5f165f11db79aba14e6ff942fe07191dec98cfd7eb65b21a  php-pecl-igbinary-3.2.7.tgz
"
